<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app"></div>
    <script src="./todomvc-app-template-master/node_modules/vue/dist/vue.js"></script>
    <script>
        // 混入代码 （抽离公共代码）
        var myMixin = {
            data: {
                msg: "10000"
            },
            created() {
                console.log(888)
                // this.init();
            },
            // data 和methods 那么以组件里面为主。
            methods: {
                init() {
                    console.log(6666)
                }
            }
        }

        const app = new Vue({
            el: '#app',
            // 哪里要用 就混入到哪里
            mixins: [myMixin],
            data: {
                msg: "999"
            },
            created() {
                this.init()
            },
            methods: {
                init() {
                    console.log(this.msg)
                }
            }
        })
    </script>
</body>
</html>